﻿<%@ Page Title="Домашняя страница" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="follow.aspx.cs" Inherits="_Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <script runat="server">
        private void InsertUser(object source, EventArgs e)
        {
            ManageProductsDataSource.Insert();
}
</script>
<script runat="server">
    private void UpdateFollow(object source, EventArgs e)
        {
            ManageProductsDataSource.Insert(); 
}
</script>
    <h2>
            Follow/Unfollow next users:
    </h2>
    <h2>
            Filter&nbsp; <asp:textbox   id="id_user"  runat="server" />
       <asp:RequiredFieldValidator
        id="RequiredFieldValidator1"
        runat="server"
        ControlToValidate="id_user"
        Display="Static"
        ErrorMessage="Please enter filter properties" />


            <asp:button   id="Button1"  runat="server"   text="Set filter"   
                onclick="InsertUser" />


   
    </h2>
<asp:SqlDataSource ID="ManageProductsDataSource" runat="server"
    ConnectionString="<%$ ConnectionStrings:SevTwitterConnectionString %>"
    DeleteCommand=
        "DELETE FROM [users] WHERE [id_user] = @original_id_user AND [Nickname] = @original_Nickname AND [Name] = @original_Name AND (([lastname] = @original_lastname) OR ([lastname] IS NULL AND @original_lastname IS NULL)) AND (([middlename] = @original_middlename) OR ([middlename] IS NULL AND @original_middlename IS NULL)) AND [id_status] = @original_id_status"
    InsertCommand=
        "INSERT INTO [users] ([id_user], [Nickname], [Name], [lastname], [middlename], [id_status]) VALUES (@id_user, @Nickname, @Name, @lastname, @middlename, @id_status)"
    SelectCommand=
        "SELECT * FROM [users]"
    
        UpdateCommand=
        "UPDATE [users] SET [Nickname] = @Nickname, [Name] = @Name, [lastname] = @lastname, [middlename] = @middlename, [id_status] = @id_status WHERE [id_user] = @original_id_user AND [Nickname] = @original_Nickname AND [Name] = @original_Name AND (([lastname] = @original_lastname) OR ([lastname] IS NULL AND @original_lastname IS NULL)) AND (([middlename] = @original_middlename) OR ([middlename] IS NULL AND @original_middlename IS NULL)) AND [id_status] = @original_id_status" 
        ConflictDetection="CompareAllValues" 
        OldValuesParameterFormatString="original_{0}">
    <DeleteParameters>
        <asp:Parameter Name="original_id_user" Type="Int32" />
        <asp:Parameter Name="original_Nickname" Type="String" />
        <asp:Parameter Name="original_Name" Type="String" />
        <asp:Parameter Name="original_lastname" Type="String" />
        <asp:Parameter Name="original_middlename" Type="String" />
        <asp:Parameter Name="original_id_status" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="Nickname" Type="String" />
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="lastname" Type="String" />
        <asp:Parameter Name="middlename" Type="String" />
        <asp:Parameter Name="id_status" Type="Int32" />
        <asp:Parameter Name="original_id_user" Type="Int32" />
        <asp:Parameter Name="original_Nickname" Type="String" />
        <asp:Parameter Name="original_Name" Type="String" />
        <asp:Parameter Name="original_lastname" Type="String" />
        <asp:Parameter Name="original_middlename" Type="String" />
        <asp:Parameter Name="original_id_status" Type="Int32" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="id_user" Type="Int32" />
        <asp:Parameter Name="Nickname" Type="String" />
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="lastname" Type="String" />
        <asp:Parameter Name="middlename" Type="String" />
        <asp:Parameter Name="id_status" Type="Int32" />
    </InsertParameters>
</asp:SqlDataSource>


    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id_users" 
                DataSourceID="ManageProductsDataSource">
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                        ShowSelectButton="True" />
                    <asp:BoundField DataField="id_users" HeaderText="id_users" ReadOnly="True" 
                        SortExpression="id_users" />
                    <asp:BoundField DataField="nick" HeaderText="nick" 
                        SortExpression="nick" />
                    <asp:BoundField DataField="name" HeaderText="name" 
                        SortExpression="name" />
                    <asp:BoundField DataField="middlename" HeaderText="middlename" 
                        SortExpression="middlename" />
                    <asp:BoundField DataField="lastname" HeaderText="lastname" 
                        SortExpression="lastname" />
                    <asp:BoundField DataField="id_status" HeaderText="id_status" 
                        SortExpression="id_status" />
                </Columns>
            </asp:GridView>
            
            <asp:button   id="Button2"  runat="server"   text="Ok"   onclick="UpdateFollow" />
            <br />
    


   
      <div class="footer">
        
        
    </div>
</asp:Content>
